home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10401 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  38 lines

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Urgent:  pow() in TurboC
  5. Date: 17 Mar 1996 08:38 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <17MAR199608381753@erich.triumf.ca>
  9. References: <4igsu5$q1t@hatathli.csulb.edu>
  10. NNTP-Posting-Host: erich.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4igsu5$q1t@hatathli.csulb.edu>, davidcho@csulb.edu (David Cho) writes...
  14.  
  15. >void main() {
  16. The C standard requires main() to return an int (despite  many books to the
  17. contrary).  If you declare main() to return void, the results are undefined,
  18. although your program will work on many systems.... (but it's not your problem)
  19.  
  20. >long int k;
  21. >  k = pow(2,23);
  22.  
  23. Did you #include <math.h>?
  24.  
  25. If you don't include the appropriate headers, the compiler will assume that
  26. pow() returns an int, and will try to convert the assumed int to a long. 
  27. Unfortunately, pow() returns a double....
  28.  
  29. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  30. Internet: bennett@triumf.ca         | of one another only when one can be
  31. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  32. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  33. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  34. or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
  35.  
  36.